<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script>
    var num = 1;
    var sum = 0;
    var agr
    while (num <= 100) {
      sum += num;
      num++;
    }
    agr = sum / 100;
    console.log('1~100之间所有数的总和为：' + sum);
    console.log('1~100之间所有数的平均值为：' + agr);
  </script>
</head>

<body>

</body>

</html>